package com.tsc.order.controller;

import com.alibaba.csp.sentinel.annotation.SentinelResource;
import com.tsc.common.response.ApiResponse;
import com.tsc.order.pojo.Order;
import com.tsc.order.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * Created with IntelliJ IDEA.
 *
 * @Author: chentl
 * @Date: 2025/08/29/22:01
 * @Description:
 */
@RestController
@RequestMapping("/order")
public class OrderController {

    @Autowired
    private OrderService orderService;


    @PostMapping("/add/one")
    public ApiResponse createOrderOne(@RequestBody Order order) {
        return ApiResponse.success(orderService.createOrderOne(order));
    }

    @PostMapping("/add/two")
    public ApiResponse createOrderTwo(@RequestBody Order order) {
        return ApiResponse.success(orderService.createOrderTwo(order));
    }


    @SentinelResource("hello")
    @GetMapping("/hello")
    public ApiResponse hello() {
        return ApiResponse.success("hello sentinel");
    }
}
